package work727;

import java.util.Date;

//普通员工
public class GeneralStaff extends  Worker implements  SalarySum{
  private int seniorityPay;//工龄工资
  private int postWage;//岗位工资
  private int post;//岗位

  public GeneralStaff() {
    this.post = 3;
  }

  public GeneralStaff(int id, String name, String sex, int age, String rank, String education, String department, Date date,int post) {
    super(id, name, sex, age, rank, education, department, date);
    this.post = post;
  }

  public int getSeniorityPay() {
    Date date = new Date(2020,7,27);
    int i =date.getYear() - super.getDate().getYear();
    return i/3*100;
  }

  public int getPost() {
    return post;
  }

  public void setPost(int post) {
    this.post = post;
  }

  public int getPostWage() {
    if (getPost() == 1){
      return 2000;
    }else if (getPost() == 2){
      return 1500;
    }else{
      return 1000;
    }
  }


  @Override
  public void sum() {
        super.setSalary(super.getBasewage() + this.getPostWage()+ this.getSeniorityPay());
    System.out.println("编号："+super.getId()+",姓名："+super.getName()+",性别："
      +super.getSex()+",年龄："+super.getAge()+",职称："+super.getRank()+",学历："
      + super.getEducation()+",所在部门："+super.getDepartment()+",入职日期："+super.getDate()+
      ",实发工资："+super.getSalary());


  }
}
